﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using IQKS.AWP.DataAccessLayer;
using IQKS.AWP.BusinessObject;

namespace IQKS.AWP.BusinessAccessLayer
{
   public class EmailByStatusBAL
    {
       public DataSet GetEmailDataByStatus(EmailByStatusBO param)
        {
            DataSet objDs;
            try
            {
                objDs = new EmailByStatusDAL().GetEmailDataByStatus(param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }

       public DataSet GetEmailTemplateId(params object[] param)
       {
           DataSet objDs;

           try
           {
               objDs = new EmailByStatusDAL().GetEmailTemplateId(param);

           }
           catch (Exception exception)
           {
               throw new ApplicationException(exception.Message);
           }
           return objDs;
       }
       

        public DataSet GetEmailTemplateNameByActivity(params object[] param)
        {
            DataSet objDs;

            EmailByStatusBO objLMBo;
            try
            {
                objLMBo = new EmailByStatusBO();
                objDs = new EmailByStatusDAL().GetActivityEmailTemplateNameByActivity(param);
                if (objDs != null)
                {
                    DataTable objDt = objDs.Tables[0];
                    if (objDt.Rows.Count>0)
                    {
                        objLMBo.GetId = Convert.ToInt32(objDt.Rows[0]["ActivityID"]);
                        
                        
                    }
                    else
                    {
                        objLMBo = null;
                    }
                }

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }


       

        public DataSet GetActivityName()
        {

            try
            {
                return new EmailByStatusDAL().GetActivityName(0);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

        public DataSet GetActivityByName(params object[] param)
        {

            try
            {
                return new EmailByStatusDAL().GetActivityByName(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

        public DataSet GetAllEmailSentStatus(params object[] param)
        {

            try
            {
                return new EmailByStatusDAL().GetAllEmailSentStatus(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

        public object SetResendEmails(EmailByStatusBO param)
        {
            try
            {
                return new EmailByStatusDAL().SetResendEmails(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
    }
}
